// pages/http/http.js
const {getBookHttp} = require("../../module/http")
const {transfromStar} = require("../../utils/index")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    book:"",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad:async function (options) {
    var res = await getBookHttp();
    
    res.data.forEach(item=>{
      item["pf"] = transfromStar(item.rating);
      item["coverImgUrl"] = item.coverImage;
      item["name"] = item.title;
      this.setData({
        book:res.data,
      })
    })
  },
})